package view.GUI.actions;

import controller.commands.DeleteCommand;
import controller.commands.DetachConnectionCommand;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import model.graphic.objects.GConnection;
import view.GUI.graphic.GraphicView;

/**
 *
 * @author Ben
 */
public class RemoveConnectionAction extends AbstractAction{
    private GConnection connection;
    private GraphicView gv;

    public RemoveConnectionAction(GConnection connection, GraphicView graphicView) {
        this.connection = connection;
        this.gv = graphicView;
    }

    public void actionPerformed(ActionEvent e) {
        gv.notifyObservers(new DetachConnectionCommand(connection));
        gv.notifyObservers(new DeleteCommand(connection));
        //gv.notifyObservers(new CustomArgument("tabRight", 1));
        gv.repaint();
    }
}
